#include"EncodeStream.h"
EncodeStream::EncodeStream()
{
    size = 0;
}

EncodeStream::~EncodeStream()
{

}

void EncodeStream::Push(EncodeBuffer *encodeBuffer)
{
    queueMutex.lock();
    encodebuffers.push(encodeBuffer);
    size++;
    queueMutex.unlock();
}

EncodeBuffer *EncodeStream::Front()
{
    queueMutex.lock();
    EncodeBuffer * ret = encodebuffers.front();
    queueMutex.unlock();
    return ret;
}

void EncodeStream::Pop()
{
    queueMutex.lock();
    encodebuffers.pop();
    size--;
    queueMutex.unlock();
}

void EncodeStream::Clear()
{
    while(!encodebuffers.empty()){
        EncodeBuffer * tem = encodebuffers.front();
        encodebuffers.pop();
        delete  tem;
    }
}

int EncodeStream::Size()
{
    int ret;
    queueMutex.lock();
    ret = size;
    queueMutex.unlock();
    return ret;
}
